{include file="common/head_s"/}
<script src="/static/plugins/layui/layui.js"></script>
<div class="main layui-clear"> 
    <div class="set_box">  
        <form method="post" class="layui-form layui-form-pane">
            <fieldset class="layui-elem-field layui-field-title" style="text-align: center;"><legend>修改登录密码</legend></fieldset>
            <div class="layui-form-item">
                <label for="L_nowpass" class="layui-form-label">当前密码</label>
                <div class="layui-input-block">
                    <input type="password" id="L_nowpass" name="nowpass" lay-verify="required" placeholder="当前登录密码" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label for="L_pass" class="layui-form-label">新 密 码</label>
                <div class="layui-input-block">
                    <input type="password" id="L_pass" name="pass" lay-verify="required" placeholder="输入新密码" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label for="L_repass" class="layui-form-label">确认密码</label>
                <div class="layui-input-block">
                    <input type="password" id="L_repass" name="repass" lay-verify="required" placeholder="确认新密码" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item"> 
                <button type="button" class="layui-btn layui-btn-fluid" lay-filter="repass" lay-submit>修改登录密码</button>     
            </div>
        </form> 
        <form method="post" class="layui-form layui-form-pane">
            <fieldset class="layui-elem-field layui-field-title" style="text-align: center;"><legend>{if $userInfo.paypwd }修改{else}设置{/if}交易密码</legend></fieldset> 
            <div class="layui-form-item">
                <label for="L_pass_pay" class="layui-form-label">交易密码</label>
                <div class="layui-input-block">
                    <input type="password" id="L_pass_pay" name="pass_pay" lay-verify="required" placeholder="{if $userInfo.paypwd }输入新交易密码{else}请设置您的交易密码{/if}" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label for="L_repass_pay" class="layui-form-label">确认密码</label>
                <div class="layui-input-block">
                    <input type="password" id="L_repass_pay" name="repass_pay" lay-verify="required" placeholder="确认交易密码" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item"> 
                <button type="button" class="layui-btn layui-btn-fluid" lay-filter="repass_pay" lay-submit>{if $userInfo.paypwd }修改{else}设置{/if}交易密码</button>     
            </div>
        </form> 

    </div>
</div> 
<script> 
    layui.use(['form', 'layer'], function () {
        var form = layui.form,$ = layui.jquery;
        // 登录提交监听
        form.on('submit(repass)', function (data) { 
            var nowpass=$('#L_nowpass').val();
            var pass=$('#L_pass').val();
            var repass=$('#L_repass').val();
            $.post("{:url('repass')}",{nowpass:nowpass,pass:pass,repass:repass},function(res){ 
                if(res.code > 0){
                    layer.msg(res.msg,{time:1000,icon:1},function(){
                        document.location.reload(); 
                    });
                }else{
                    layer.msg(res.msg,{time:1000,icon:2}); 
                }
            });
            return false;
        }); 
        // 登录提交监听
        form.on('submit(repass_pay)', function (data) { 
            var pass_pay=$('#L_pass_pay').val();
            var repass_pay=$('#L_repass_pay').val(); 
            $.post("{:url('repasspay')}",{pass_pay:pass_pay,repass_pay:repass_pay},function(res){ 
                if(res.code > 0){
                    layer.msg(res.msg,{time:1000,icon:1},function(){
                        document.location.reload(); 
                    });
                }else{
                    layer.msg(res.msg,{time:1000,icon:2}); 
                }
            });
            return false;
        }); 
    });
</script> 
</body>
</html>